fldmeta_prop.func.TextAnnotation = {};

//on style change
fldmeta_prop.func.TextAnnotation.onDisplayStyle = function(elemid, rId, nv) {
	if (rId=="displayStyle_bgColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({"fill" : nv || flstyle.elem.attrs.textannotation.fill});
	} else if (rId=="displayStyle_bgOpacity") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual rect").attr({ opacity: Number(nv) || flstyle.elem.attrs.textannotation.opacity});
	} else if (rId=="displayStyle_fontColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual text").attr({"fill" : nv || flstyle.elem.defaultFontColor});
	} else if (rId=="displayStyle_BorderStrokeWidth") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual path").attr({"strokeWidth" : nv ? parseInt(nv) : flstyle.elem.attrs.textannotation.strokeWidth});
	} else if (rId=="displayStyle_BorderColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual path").attr({"stroke" : nv || flstyle.elem.attrs.textannotation.stroke});
	}
};

//properties settings for TextAnnotation
fldmeta_prop.control.TextAnnotation = {
		"includes-properties" : {
			"common" : fldmeta_prop.common.all.properties
		},
		"properties" : {
		},
		"abandon-properties" : ["description"],
		"styles" : {
			"displayStyle" : {
				"name" : fmd_i18n_prop_tip_customstyle,
				"img" : "css.png",
		    	"cellType" : {
		    		"type" : "coro",
		    		"options" : fmd_i18n_prop_displayStyle_vals
		    	},
		    	"value" : {"default":"theme"},
		    	"conditional-sub" : {
		    		"custom" : {
		    			"displayStyle_bgColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_bgColor"]);
		    				obj1.value["default"] = flstyle.elem.attrs.textannotation.fill;
		    				return obj1;
		    			},
		        		"displayStyle_bgOpacity" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_bgOpacity"]);
		    				obj1.value["default"] = flstyle.elem.attrs.textannotation.opacity;
		    				return obj1;
		    			},
		    			//"displayStyle_connPathColor" : fldmeta_prop.common.predefined["displayStyle_connPathColor"],
		    			"displayStyle_fontColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_fontColor"]);
		    				obj1.value["default"] = flstyle.elem.defaultFontColor;
		    				return obj1;
		    			},
		    			"displayStyle_BorderStrokeWidth" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderStrokeWidth"]);
		    				obj1.value["default"] = flstyle.elem.attrs.textannotation.strokeWidth;
		    				return obj1;
		    			},
		        		"displayStyle_BorderColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderColor"]);
		    				obj1.value["default"] = flstyle.elem.attrs.textannotation.stroke;
		    				return obj1;
		    			}
		    		}
		    	}
			}
		},
		"onApply" : function() {
		},
		"propDhxGridEvents" : {
			"onCellChanged" : function(rId,cId,nv) {
				fldmeta_prop.func.onCellChanged_common(rId,cId,nv,
						JSONSelect.match("."+rId, fldmeta_prop.control.TextAnnotation));
				fldmeta_prop.func.onCellChanged_stylecommon(rId,cId,nv);
			}
		}
	};



